package br.com.extrajudicial.models;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.validator.Min;
import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;

@Entity
@Table(name="items")
public class Item implements Serializable {

	private static final long serialVersionUID = 3391129682932801358L;
	
	@Id @GeneratedValue
	private Long id;
	@NotNull @NotEmpty
	private String name;
	@NotNull @Column(name="is_active")
	private Boolean active;
	@NotNull @Min(0) @Column(name="unity_price")
	private BigDecimal unityPrice;
	@OneToMany (cascade = {CascadeType.PERSIST, CascadeType.MERGE}, mappedBy = "item")
	private List<ItemOrder> itemorders;

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Boolean getActive() {
		return active;
	}
	public void setActive(Boolean active) {
		this.active = active;
	}
	public BigDecimal getUnityPrice() {
		return unityPrice;
	}
	public void setUnityPrice(BigDecimal unityPrice) {
		this.unityPrice = unityPrice;
	}
	public List<ItemOrder> getItemorders() {
		return itemorders;
	}
	public void setItemorders(List<ItemOrder> itemorders) {
		this.itemorders = itemorders;
	}
	
}
